<?php

/**
 * 管理员权限菜单
 * 说明：权限菜单采用四级结构，即 应用(app) - 模块(module) - 控制器(菜单controle) - 操作(接口和视图action)
 */
$adminMenus = [
    // 运营数据
    'm_admin_index' => [
        'title' => '运营数据',  'child_menus' => [
            'Index' => ['title' => '运营数据', 'url' => 'index/main'],
        ]
    ],

    // 用户管理
    'm_user' => [
        'title' => '用户管理',  'child_menus' => [
            // - - 用户管理
            'UsrUser' => ['title' => '用户管理', 'url' => 'usr-user/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'usr-user/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'usr-user/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'usr-user/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'usr-user/delete'],
            ]],
            // - - 用户等级管理
            'UsrLevel' => ['title' => '用户等级', 'url' => 'usr-level/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'usr-level/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'usr-level/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'usr-level/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'usr-level/delete'],
            ]],
            // - - 用户收货地址管理
            'UsrAddress' => ['title' => '用户收货地址管理', 'url' => 'usr-address/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'usr-address/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'usr-address/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'usr-address/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'usr-address/delete'],
            ]],
            // - - 用户日志管理
            'UsrLog' => ['title' => '用户日志管理', 'url' => 'usr-log/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'usr-log/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'usr-log/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'usr-log/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'usr-log/delete'],
            ]],
            // - - 推广员管理
            'UsrPromoter' => ['title' => '推广员管理', 'url' => 'usr-promoter/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'usr-promoter/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'usr-promoter/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'usr-promoter/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'usr-promoter/delete'],
            ]],
        ],
    ],
    // 更多的模块规则记录

    // 商品模块管理（代码示例，仅供参考）
    'm_goods' => [
        'title' => '商品模块管理',  'child_menus' => [
            // - - 商品管理
            'EcGoods' => ['title' => '盲盒管理', 'url' => 'ec-goods/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'ec-goods/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'ec-goods/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'ec-goods/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'ec-goods/delete'],
            ]],
        ]
    ],

    // 订单模块管理（代码示例，仅供参考）
    'm_order' => [
        'title' => '订单模块管理',  'child_menus' => [
            // - - 订单管理
            'EcOrder' => ['title' => '订单管理', 'url' => 'ec-order/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'ec-order/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'ec-order/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'ec-order/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'ec-order/delete'],
            ]],
            // - - 订单商品管理
            'EcOrderDetail' => ['title' => '订单商品管理', 'url' => 'ec-order-detail/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'ec-order-detail/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'ec-order-detail/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'ec-order-detail/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'ec-order-detail/delete'],
            ]],
            // - - 订单操作日志管理
            'EcOrderLog' => ['title' => '订单操作日志管理', 'url' => 'ec-order-log/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'ec-order-log/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'ec-order-log/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'ec-order-log/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'ec-order-log/delete'],
            ]],
            // - - 订单退货管理
            'EcOrderReturn' => ['title' => '订单退货管理', 'url' => 'ec-order-return/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'ec-order-return/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'ec-order-return/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'ec-order-return/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'ec-order-return/delete'],
            ]],
        ]
    ],

    // ...
];

/**
 * ESX管理员权限菜单
 * 说明：权限菜单采用四级结构，即 应用(app) - 模块(module) - 控制器(菜单controle) - 操作(接口和视图action)
 */
$esxAdminMenus = [
    // 系统管理
    'm_esxdm_sys' => [
        'title' => '系统管理',  'child_menus' => [
            // - - 系统配置管理
            'EsxdmSysSettings' => ['title' => '系统配置管理', 'url' => 'esxdm-sys-config/settings', 'child_methods' => [
                'settings' => ['title' => '显示资源配置表单页', 'url' => 'esxdm-sys-config/settings'],
            ]],
            // - - 系统字典管理
            'EsxdmSysConfig' => ['title' => '系统字典管理', 'url' => 'esxdm-sys-config/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'esxdm-sys-config/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'esxdm-sys-config/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'esxdm-sys-config/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'esxdm-sys-config/delete'],
            ]],
            // - - 配置分组管理
            'EsxdmSysConfigGroup' => ['title' => '配置分组管理', 'url' => 'esxdm-sys-config-group/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'esxdm-sys-config-group/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'esxdm-sys-config-group/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'esxdm-sys-config-group/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'esxdm-sys-config-group/delete'],
            ]],
            // - - APP版本管理
            'EsxdmSysVersion' => ['title' => 'APP版本管理', 'url' => 'esxdm-sys-version/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'esxdm-sys-version/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'esxdm-sys-version/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'esxdm-sys-version/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'esxdm-sys-version/delete'],
            ]],
            // - - 定时任务管理
            'EsxdmSysCrontab' => ['title' => '定时任务管理', 'url' => 'esxdm-sys-crontab/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'esxdm-sys-crontab/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'esxdm-sys-crontab/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'esxdm-sys-crontab/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'esxdm-sys-crontab/delete'],
            ]],
            // - - 定时任务日志管理
            'EsxdmSysCrontabLog' => ['title' => '定时任务日志管理', 'url' => 'esxdm-sys-crontab-log/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'esxdm-sys-crontab-log/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'esxdm-sys-crontab-log/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'esxdm-sys-crontab-log/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'esxdm-sys-crontab-log/delete'],
            ]],
            // - - 附件管理
            'EsxdmSysAttachment' => ['title' => '附件管理', 'url' => 'esxdm-sys-attachment/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'esxdm-sys-attachment/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'esxdm-sys-attachment/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'esxdm-sys-attachment/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'esxdm-sys-attachment/delete'],
            ]],
            // - - 附件分类管理
            'EsxdmSysAttachmentCategory' => ['title' => '附件分类管理', 'url' => 'esxdm-sys-attachment-category/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'esxdm-sys-attachment-category/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'esxdm-sys-attachment-category/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'esxdm-sys-attachment-category/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'esxdm-sys-attachment-category/delete'],
            ]],
            // - - 短信验证码
            'EsxdmSysSmsCaptcha' => ['title' => '短信验证码', 'url' => 'esxdm-sys-sms-captcha/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'esxdm-sys-sms-captcha/index'],
                'delete' => ['title' => '删除指定资源', 'url' => 'esxdm-sys-sms-captcha/delete'],
            ]],
            // - - 邮件验证码
            'EsxdmSysEmailCaptcha' => ['title' => '邮件验证码', 'url' => 'esxdm-sys-email-captcha/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'esxdm-sys-email-captcha/index'],
                'delete' => ['title' => '删除指定资源', 'url' => 'esxdm-sys-email-captcha/delete'],
            ]],
            // - - 留言反馈
            'EsxdmSysFeedback' => ['title' => '留言反馈', 'url' => 'esxdm-sys-feedback/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'esxdm-sys-feedback/index'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'esxdm-sys-feedback/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'esxdm-sys-feedback/delete'],
            ]],
            // - - 系统消息管理
            'EsxdmSysMessage' => ['title' => '系统消息管理', 'url' => 'esxdm-sys-message/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'esxdm-sys-message/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'esxdm-sys-message/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'esxdm-sys-message/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'esxdm-sys-message/delete'],
            ]],
            // - - 系统通知管理
            'EsxdmSysNotice' => ['title' => '系统通知管理', 'url' => 'esxdm-sys-notice/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'esxdm-sys-notice/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'esxdm-sys-notice/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'esxdm-sys-notice/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'esxdm-sys-notice/delete'],
            ]],
            // - - 系统标签管理
            'EsxdmSysTags' => ['title' => '系统标签管理', 'url' => 'esxdm-sys-tags/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'esxdm-sys-tags/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'esxdm-sys-tags/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'esxdm-sys-tags/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'esxdm-sys-tags/delete'],
            ]],
            // - - 搜索关键词管理
            'EsxdmSysSearch' => ['title' => '搜索关键词管理', 'url' => 'esxdm-sys-search/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'esxdm-sys-search/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'esxdm-sys-search/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'esxdm-sys-search/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'esxdm-sys-search/delete'],
            ]],
            // - - 搜索关键词对象管理
            'EsxdmSysSearchItem' => ['title' => '搜索关键词对象管理', 'url' => 'esxdm-sys-search_item/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'esxdm-sys-search_item/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'esxdm-sys-search_item/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'esxdm-sys-search_item/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'esxdm-sys-search_item/delete'],
            ]],
            // - - 搜索关键词日志管理
            'EsxdmSysSearchLog' => ['title' => '搜索关键词日志管理', 'url' => 'esxdm-sys-search-log/index', 'child_methods' => [
                'index' => ['title' => '显示资源列表', 'url' => 'esxdm-sys-search-log/index'],
                'create' => ['title' => '显示创建资源表单页', 'url' => 'esxdm-sys-search-log/create'],
                'edit' => ['title' => '显示编辑资源表单页', 'url' => 'esxdm-sys-search-log/edit'],
                'delete' => ['title' => '删除指定资源', 'url' => 'esxdm-sys-search-log/delete'],
            ]],
        ],
    ],
    // 权限管理
    'm_esxdm_auth' => ['title' => '权限管理',  'child_menus' => [
        // - - 管理员管理
        'EsxdmAuthAdmin' => ['title' => '管理员管理', 'url' => 'esxdm-auth-admin/index', 'child_methods' => [
            'index' => ['title' => '显示资源列表', 'url' => 'esxdm-auth-admin/index'],
            'create' => ['title' => '显示创建资源表单页', 'url' => 'esxdm-auth-admin/create'],
            'edit' => ['title' => '显示编辑资源表单页', 'url' => 'esxdm-auth-admin/edit'],
            'profile' => ['title' => '显示指定的资源表单页', 'url' => 'esxdm-auth-admin/profile'],
            'delete' => ['title' => '删除指定资源', 'url' => 'esxdm-auth-admin/delete'],
        ]],
        // - - 分组管理
        'EsxdmAuthGroup' => ['title' => '分组管理', 'url' => 'esxdm-auth-group/index', 'child_methods' => [
            'index' => ['title' => '显示资源列表', 'url' => 'esxdm-auth-group/index'],
            'create' => ['title' => '显示创建资源表单页', 'url' => 'esxdm-auth-group/create'],
            'edit' => ['title' => '显示编辑资源表单页', 'url' => 'esxdm-auth-group/edit'],
            'delete' => ['title' => '删除指定资源', 'url' => 'esxdm-auth-group/delete'],
        ]],
        // - - 规则管理
        'EsxdmAuthRule' => ['title' => '规则管理', 'url' => 'esxdm-auth-rule/index', 'child_methods' => [
            'index' => ['title' => '显示资源列表', 'url' => 'esxdm-auth-rule/index'],
            'create' => ['title' => '显示创建资源表单页', 'url' => 'esxdm-auth-rule/create'],
            'edit' => ['title' => '显示编辑资源表单页', 'url' => 'esxdm-auth-rule/edit'],
            'delete' => ['title' => '删除指定资源', 'url' => 'esxdm-auth-rule/delete'],
        ]],
        // - - 管理员日志
        'EsxdmAuthAdminLog' => ['title' => '管理员日志', 'url' => 'esxdm-auth-admin-log/index', 'child_methods' => [
            'index' => ['title' => '显示资源列表', 'url' => 'esxdm-auth-admin-log/index'],
        ]],
    ]],
    // 更多的模块规则记录
    // ...
];
// 汇总
$data = [
    'admin' => ['title' => '通用后台', 'app' => 'admin', 'child_modules' => array_merge($adminMenus,$esxAdminMenus)],
];

return [
    'table' => 'esxdm_auth_rule',
    'text' => '管理员权限菜单',
    'truncate' => true,
    'data' => $data,
    // 权限规则表插入语句（注意，字段位置是固定的，不要更改）
    'insert_sql' => 'insert into esxdm_auth_rule (id, pid, rule_title, rule_name, url, icon, is_menu, `status`, app_flag) values ',
    // 动态更新权限组的规则字段的值（__rules__变量表示规则ID，__app__变量表示应用名称）
    'update_auth_group_sql' => "update esxdm_auth_group set rules='__rules__' where group_name='__app__'"
];
